<!--请求方管理页面-->
<template>
    <div>
        <el-row>
            <el-col :span="22" class="toolbar marginTop10px" id="serachId">
                <el-form :model="conditionForm" ref="conditionFormRef">
                    
                        <el-button type="primary" size="small" @click="dialogFormVisible = true" style="float:left;margin-top:4px;" v-if="isShow('requester-add')">注册</el-button>
                    
                    <el-form-item style="float:right">
                        <el-button type="primary" size="small" @click="onSearch">&nbsp;搜索</el-button>
                    </el-form-item>
                    <el-form-item style="float:right;margin-right: 15px;">
                        <el-select v-model="conditionForm.status" size="small" placeholder="请选择">
                            <el-option label="待审核" value="0"></el-option>
                            <el-option label="审核通过" value="3"></el-option>
                            <el-option label="审核不通过" value="4"></el-option>
                            <el-option label="全部" value=""></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item style="float:right;margin-right: 15px">
                        <el-input v-model="conditionForm.serialNo" size="small" placeholder="请求方标识"></el-input>
                    </el-form-item>
                    <el-form-item style="float:right;margin-right: 15px">
                        <el-input v-model="conditionForm.requester" size="small" placeholder="请求方名称"></el-input>
                    </el-form-item>
                    <el-form-item style="float:right;margin-right: 15px">
                        <el-input v-model="conditionForm.contactsPhone" size="small" placeholder="联系人电话"></el-input>
                    </el-form-item>
                    <el-form-item style="float:right;margin-right: 15px">
                        <el-input v-model="conditionForm.contactsName" size="small" placeholder="联系人姓名"></el-input>
                    </el-form-item>
                    
                </el-form>
            </el-col>
        </el-row>
        <el-row class="toolbar">
            <el-col :span="23" class="titleLineSymbolTwo">
                <!--列表、table-->
                <el-table :data="resultDate.data.list" stripe style="width: 100%">
                    <el-table-column prop="serialNo" label="请求者标识" min-width="100"></el-table-column>
                    <el-table-column prop="requester" label="请求方名称" min-width="100"></el-table-column>
                    <el-table-column prop="apiType" label="API接口类型" min-width="100"></el-table-column>
                    <el-table-column prop="apiAddress" label="请求方地址" min-width="100"></el-table-column>
                    <el-table-column prop="apiPort" label="请求方端口号" min-width="110"></el-table-column>
                    <el-table-column prop="requestNetwork" label="请求方所属的网络类型" min-width="160">
                        <template scope="scope">
                            <span v-html="formatDicTionary(scope.row.requestNetwork,'api_location')"></span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="organizationId" label="管理单位机构代码" min-width="140"></el-table-column>
                    <el-table-column prop="organization" label="管理单位名称" min-width="160"></el-table-column>
                    <el-table-column prop="requestMac" label="请求者的mac地址" min-width="160"></el-table-column>
                    <!--<el-table-column prop="userId" label="所在本平台ID" min-width="110"></el-table-column>-->
                    <el-table-column prop="status" label="状态" min-width="100" >
                        <template scope="scope">
                            <span v-html="formatDicTionary(scope.row.status,'status_type')"></span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="auditTime" label="审核时间" width="155" :formatter="formatCommDatas"></el-table-column>
                    <el-table-column prop="contactsName" label="联系人姓名" min-width="120"></el-table-column>
                    <el-table-column prop="contactsPhone" label="联系电话" min-width="130"></el-table-column>
                    <el-table-column prop="isDel" label="是否删除" width="80" :formatter="formatCommDatas"></el-table-column>
                    <el-table-column prop="createTime" label="创建时间" width="155" :formatter="formatCommDatas"></el-table-column>
                    <el-table-column prop="createByName" label="创建者" width="100"></el-table-column>
                    <el-table-column prop="modifiedTime" label="最后修改时间" width="155" :formatter="formatCommDatas"></el-table-column>
                    <el-table-column prop="lastUpdateByName" label="最后修改者" width="110"></el-table-column>
                    <el-table-column label="操作" width="300" fixed="right">
                        <template slot-scope="scope">
                            <el-button type="text" size="small" v-if="isShow('requester-edit') && isShowEditOrDelete(scope.row.status,'editDel')" @click="showUpdateForm(scope.$index, scope.row)">编辑</el-button>
                            <el-button type="text" size="small" v-if="isShow('requester-resubmit') && isShowEditOrDelete(scope.row.status,'resubmit')" @click="resubmit(scope.$index, scope.row, 'updateFormRef')">重新提交</el-button>
                            <el-button type="text" size="small" v-if="isShow('requester-delete') && isShowEditOrDelete(scope.row.status,'editDel')" @click="handleDel(scope.$index, scope.row)">删除</el-button>
                            <el-button type="text" size="small" v-if="isShow('requester-viewDetails')" @click="showViewDetails(scope.$index, scope.row)">查看详情</el-button>
                            <el-button type="text" size="small" v-if="isShow('requester-pass') && isShowCheck(scope.row.status,'pass')" @click="audit(scope.row,'yes')">审核通过</el-button>
                            <el-button type="text" size="small" v-if="isShow('requester-noPass') && isShowCheck(scope.row.status,'noPass')" @click="audit(scope.row,'no')">审核不通过</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-col>
            <!--分頁插件-->
            <el-col :span="23" class=" marginTop10px">
                <el-pagination layout="total, prev, pager, next, jumper" @current-change="handleCurrentPageChange"
                            :current-page="resultDate.data.pageNum"
                            :page-size="resultDate.data.pageSize" :total="resultDate.data.total">
                </el-pagination>
            </el-col>

            <!--新增界面-->
            <!-- <el-dialog title="新增请求方" :visible.sync="dialogFormVisible" width="50%" :before-close="handleClose"
                    :modal-append-to-body="false"> -->
            <Modal v-model="dialogFormVisible" title="新增请求方" width='50%' :before-close="handleClose">
                <el-card>
                <el-form :model="addForm" ref="addFormRef" :rules="formRules">
                    <el-row>
                        <el-col :span="24">
                            <el-form-item label="请求接口地址" :label-width="formLabelWidth" prop="apiAddress">
                                <el-input v-model="addForm.apiAddress" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="请求接口端口号" :label-width="formLabelWidth" prop="apiPort">
                                <el-input v-model="addForm.apiPort" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="API接口类型" :label-width="formLabelWidth" prop="apiType">
                                <el-input v-model="addForm.apiType" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="请求者标识" :label-width="formLabelWidth" prop="serialNo">
                                <el-input v-model="addForm.serialNo" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="请求方名称" :label-width="formLabelWidth" prop="requester">
                                <el-input v-model="addForm.requester" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="请求方所属的网络类型" :label-width="formLabelWidth" prop="requestNetwork">
                                <!--<el-input v-model="addForm.requestNetwork" auto-complete="off"></el-input>-->
                                <template>
                                    <el-select v-model="addForm.requestNetwork" placeholder="请选择服务接口所在区域"  clearable filterable>
                                        <el-option
                                                v-for="item in apiLocationList"
                                                :key="item.value"
                                                :label="item.name"
                                                :value="item.value">
                                        </el-option>
                                    </el-select>
                                </template>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="管理单位机构代码" :label-width="formLabelWidth" prop="organizationId">
                                <el-input v-model="addForm.organizationId" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="管理单位名称" :label-width="formLabelWidth" prop="organization">
                                <el-input v-model="addForm.organization" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="请求者的mac地址" :label-width="formLabelWidth" prop="requestMac">
                                <el-input v-model="addForm.requestMac" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="联系人姓名" :label-width="formLabelWidth" prop="contactsName">
                                <el-input v-model="addForm.contactsName" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="联系电话" :label-width="formLabelWidth" prop="contactsPhone">
                                <el-input v-model="addForm.contactsPhone" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <!--<el-col :span="12">-->
                            <!--<el-form-item label="所在本平台ID" :label-width="formLabelWidth" prop="userId">-->
                                <!--<el-input v-model="addForm.userId" auto-complete="off"></el-input>-->
                            <!--</el-form-item>-->
                        <!--</el-col>-->
                        <el-col :span="12">
                            <el-form-item label="开发者用户标识" :label-width="formLabelWidth" prop="devId">
                                <el-select v-model="addForm.devId" placeholder="请选择">
                                    <el-option v-for="item in userData" :key="item.id" :label="item.name"
                                            :value="item.userId"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
                </el-card>
                <div slot="footer" class="dialog-footer">
                    <el-button @click="dialogFormVisible = false">取 消</el-button>
                    <el-button type="primary" @click="submitForm('addFormRef')">确 定</el-button>
                </div>
            </Modal>
            <!-- </el-dialog> -->


            <!--编辑界面-->
            <!-- <el-dialog title="编辑请求方" :visible.sync="updateFormVisible" width="50%" :before-close="handleClose"
                    :modal-append-to-body="false"> -->
            <Modal v-model="updateFormVisible" title="编辑请求方" width='50%' :before-close="handleClose">
                <el-card>
                <el-form :model="updateForm" ref="updateFormRef" :rules="formRules">
                    <el-row>
                        <el-col :span="24">
                            <el-form-item label="请求接口地址" :label-width="formLabelWidth" prop="apiAddress">
                                <el-input v-model="updateForm.apiAddress" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="请求接口端口号" :label-width="formLabelWidth" prop="apiPort">
                                <el-input v-model="updateForm.apiPort" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="API接口类型" :label-width="formLabelWidth" prop="apiType">
                                <el-input v-model="updateForm.apiType" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="请求者标识" :label-width="formLabelWidth" prop="serialNo">
                                <el-input v-model="updateForm.serialNo" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="请求方名称" :label-width="formLabelWidth" prop="requester">
                                <el-input v-model="updateForm.requester" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="请求方所属的网络类型" :label-width="formLabelWidth" prop="requestNetwork">
                                <!--<el-input v-model="updateForm.requestNetwork" auto-complete="off"></el-input>-->
                                <template>
                                    <el-select v-model="updateForm.requestNetwork" placeholder="请选择服务接口所在区域"  clearable filterable>
                                        <el-option
                                                v-for="item in apiLocationList"
                                                :key="item.value"
                                                :label="item.name"
                                                :value="item.value">
                                        </el-option>
                                    </el-select>
                                </template>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="管理单位机构代码" :label-width="formLabelWidth" prop="organizationId">
                                <el-input v-model="updateForm.organizationId" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="管理单位名称" :label-width="formLabelWidth" prop="organization">
                                <el-input v-model="updateForm.organization" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="请求者的mac地址" :label-width="formLabelWidth" prop="requestMac">
                                <el-input v-model="updateForm.requestMac" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="联系人姓名" :label-width="formLabelWidth" prop="contactsName">
                                <el-input v-model="updateForm.contactsName" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="联系电话" :label-width="formLabelWidth" prop="contactsPhone">
                                <el-input v-model="updateForm.contactsPhone" auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <!--<el-col :span="12">-->
                            <!--<el-form-item label="所在本平台ID" :label-width="formLabelWidth" prop="userId">-->
                                <!--<el-input v-model="updateForm.userId" auto-complete="off"></el-input>-->
                            <!--</el-form-item>-->
                        <!--</el-col>-->
                        <el-col :span="12">
                            <el-form-item label="开发者用户标识" :label-width="formLabelWidth" prop="devId">
                                <el-select v-model="updateForm.devId" placeholder="请选择">
                                    <el-option v-for="item in userData" :key="item.id" :label="item.name"
                                            :value="item.userId"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
                </el-card>
                <div slot="footer" class="dialog-footer">
                    <el-button @click="updateFormVisible = false">取 消</el-button>
                    <el-button type="primary" @click="doUpdate('updateFormRef')">确 定</el-button>
                </div>
            </Modal>
            <!-- </el-dialog> -->

            <!-- 查看详情 -->
            <Modal v-model="detailsVisible" title="查看详情" width='50%' :before-close="handleClose">
                <el-card>
                <el-form :model="updateForm" ref="updateFormRef">
                    <el-row>
                        <el-col :span="24">
                            <el-form-item label="请求接口地址" :label-width="formLabelWidth" prop="apiAddress">
                                <el-input v-model="updateForm.apiAddress" auto-complete="off" :disabled="true"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="请求接口端口号" :label-width="formLabelWidth" prop="apiPort">
                                <el-input v-model="updateForm.apiPort" auto-complete="off" :disabled="true"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="API接口类型" :label-width="formLabelWidth" prop="apiType">
                                <el-input v-model="updateForm.apiType" auto-complete="off" :disabled="true"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="请求者标识" :label-width="formLabelWidth" prop="serialNo">
                                <el-input v-model="updateForm.serialNo" auto-complete="off" :disabled="true"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="请求方名称" :label-width="formLabelWidth" prop="requester">
                                <el-input v-model="updateForm.requester" auto-complete="off" :disabled="true"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="请求方所属的网络类型" :label-width="formLabelWidth" prop="requestNetwork">
                                <!--<el-input v-model="updateForm.requestNetwork" auto-complete="off"></el-input>-->
                                <template>
                                    <el-select v-model="updateForm.requestNetwork" placeholder="请选择服务接口所在区域"  clearable filterable :disabled="true">
                                        <el-option
                                                v-for="item in apiLocationList"
                                                :key="item.value"
                                                :label="item.name"
                                                :value="item.value">
                                        </el-option>
                                    </el-select>
                                </template>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="管理单位机构代码" :label-width="formLabelWidth" prop="organizationId">
                                <el-input v-model="updateForm.organizationId" auto-complete="off" :disabled="true"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="管理单位名称" :label-width="formLabelWidth" prop="organization">
                                <el-input v-model="updateForm.organization" auto-complete="off" :disabled="true"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="请求者的mac地址" :label-width="formLabelWidth" prop="requestMac">
                                <el-input v-model="updateForm.requestMac" auto-complete="off" :disabled="true"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="联系人姓名" :label-width="formLabelWidth" prop="contactsName">
                                <el-input v-model="updateForm.contactsName" auto-complete="off" :disabled="true"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="联系电话" :label-width="formLabelWidth" prop="contactsPhone">
                                <el-input v-model="updateForm.contactsPhone" auto-complete="off" :disabled="true"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <!--<el-col :span="12">-->
                            <!--<el-form-item label="所在本平台ID" :label-width="formLabelWidth" prop="userId">-->
                                <!--<el-input v-model="updateForm.userId" auto-complete="off"></el-input>-->
                            <!--</el-form-item>-->
                        <!--</el-col>-->
                        <el-col :span="12">
                            <el-form-item label="开发者用户标识" :label-width="formLabelWidth" prop="devId">
                                <el-select v-model="updateForm.devId" placeholder="请选择" :disabled="true">
                                    <el-option v-for="item in userData" :key="item.id" :label="item.name"
                                            :value="item.userId"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
                </el-card>
                <div slot="footer" class="dialog-footer">
                    <el-button @click="detailsVisible = false">关 闭</el-button>
                </div>
            </Modal>
        </el-row>
    </div>
</template>
<script>

    import {req_add, req_check, req_del, req_searchByCondition, req_update, req_seachUserByCurrent} from '../api/api.js';
    import utils from '../api/utils.js';
    export default {

        data() {
            return {
                apiLocationList: [{}],// 网络所在区域 列表
                userData:[],
                roleId:-1,
                resultDate: {data:{total:0, pageNum: 0}},// 列表数据对象
                formLabelWidth: '120px',// 新增界面label大小
                addForm: {requestNetwork:"2"},//新增界面数据},
                dialogFormVisible: false,//新增界面是否显示
                formRules: { // 新增界面校验规则
                    contactsPhone: [
                        {required: true, message: '请输入联系人名称', trigger: 'blur'}
                    ],
                    contactsName: [
                        {required: true, message: '请输入联系人电话', trigger: 'blur'}
                    ],
                    apiType: [
                        {required: true, message: '请输入请求者接口类型', trigger: 'blur'}
                    ],
                    apiAddress: [
                        {required: true, message: '请输入请求者接口地址', trigger: 'blur'}
                    ],
                    apiPort: [
                        {required: true, message: '请输入接口端口号', trigger: 'blur'}
                        // ,{type: 'number', message: '端口号必须为数字'}
                    ],
                    serialNo: [
                        {required: true, message: '请输入请求者标识', trigger: 'blur'}
                    ],
                    requester: [
                        {required: true, message: '请输入请求方名称', trigger: 'blur'}
                    ],
                    requestNetwork: [
                        {required: true, message: '请输入请求方所属的网络类型', trigger: 'blur'}
                    ],
                    organizationId: [
                        {required: true, message: '请输入管理单位机构代码', trigger: 'blur'}
                    ],
                    organization: [
                        {required: true, message: '请输入管理单位名称', trigger: 'blur'}
                    ],
                    requestMac: [
                        {required: true, message: '请输入请求者的mac地址', trigger: 'blur'}
                    ],
                    userId: [
                        {required: true, message: '请输入本平台用户ID', trigger: 'blur'}
                    ],
                    devId: [
                        {required: true, message: '请选开发者的用户标识', trigger: 'blur'}
                    ],
                },
                updateForm: {},// ---------  更新
                updateFormVisible: false,
                conditionForm: {status:"0" ,searchType: "", keyword: "",contactsName:"" ,contactsPhone:"" ,serialNo:"",requester:"", pageSize: 5},
                searchTypeOptions: [{
                    value: 'serialNo',
                    label: '请求者标识'
                }, {
                    value: 'requester',
                    label: '请求方名称'
                }, {
                    value: 'requestNetwork',
                    label: '请求方所属的网络类型'
                }, {
                    value: 'organizationId',
                    label: '管理单位机构代码'
                }, {
                    value: 'organization',
                    label: '管理单位名称'
                }, {
                    value: 'requestMac',
                    label: '请求者的mac地址'
                }, {
                    value: 'userId',
                    label: '请输入本平台用户ID',
                }],
                detailsVisible: false,
            };
        },
        methods: {
            isShow: function (resource) { //资源权限管理
                return utils.apiResourcePermissions(resource);
            },
            isShowEditOrDelete: function (status,type) { //资源权限管理 根据审核情况是否显示（编辑/删除）
                return utils.apiIsShowEditOrDelete(status,this.roleId,type);
            },
            isShowCheck: function(status,type){ // 资源权限管理 根据审核情况是否显示（审核）
                return utils.apiIsShowCheck(status,this.roleId,type)
            },
            handleCurrentPageChange: function (currentPage) {// 翻页动作
                this.currentPage = currentPage;
                this.onSearch();// 翻页后刷新页面数据
            },
            handleClose(done) { // 新增界面关闭事件
                this.$confirm('确认关闭？', "提示").then(_ => {
                    done();
                }).catch(_ => {
                });
            },
            seachUserByCurrent(){
                let roleId = "";
                if(utils.isEmpty(localStorage.apiPermission)){
                    return;
                }
                let arr = JSON.parse(localStorage.apiPermission);
                arr.forEach(obj => {
                    roleId = obj.roleId;
                    return
                });
                this.roleId = roleId;
                let params = {
                    roleId: roleId
                };
                req_seachUserByCurrent(params)
                    .then(res => {
                        this.userData = res.data.data;
                    }).catch(function (error) {
                    console.log(error);
                    _this.$message.warning('系统异常 ');
                });
            },
            submitForm(formName) { // 新增界面提交事件
                let params = Object.assign({}, this.$refs[formName]._props.model);
                params.status = 1;
                console.log(params);
                var _this = this
                _this.$refs[formName].validate((valid) => {
                    if (valid) {
                        _this.$confirm('确认提交吗？', '提示', {}).then(() => {
                            req_add(params).then(res => {
                                console.log(res.data.msg);
                                _this.$message.success(res.data.msg);
                                if (res.data.code == 'S100101') {
                                    _this.addForm = {};
                                    _this.onSearch();
                                }
                            }).catch(err => {
                                _this.$message.error("系统异常");
                                console.log(err);
                            });
                            _this.dialogFormVisible = false;
                        });
                    }
                });
            },
            // 查询
            onSearch(){  // 发出列表请求，并更新当前页面数据
                var _this = this
                _this.conditionForm.pageNum = _this.currentPage;
                //角色
                _this.conditionForm.roleId = this.roleId;
                req_searchByCondition(_this.conditionForm)
                    .then(res => {
                        _this.resultDate = res.data;
                    }).catch(function (error) {
                    console.log(error);
                    _this.$message.warning('系统异常 ');
                });
            },
            //删除
            handleDel (index, row) { // 数据项删除操作
                var _this = this
                _this.$confirm('是否删除当前该记录?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    req_del(row.id).then((res) => {
                        if (res.data.code == 'S100101') {
                            _this.$message.success('删除成功!');
                            _this.onSearch();
                        } else {
                            _this.$message.warning('删除失败! ' + res.data.msg);
                            _this.onSearch();
                        }
                    }).catch((res) => {
                        _this.$message.error('删除失败!');
                    });
                })
            },

            showUpdateForm(index, row){
                this.updateForm = {};
                this.updateFormVisible = true;
                this.updateForm = Object.assign({}, row);
            },
            showViewDetails(index, row){
                this.updateForm = {};
                this.detailsVisible = true;
                this.updateForm = Object.assign({}, row);
            },
            doUpdate(formName){
                var _this = this
                _this.$refs[formName].validate((valid) => {
                    if (valid) {
                        _this.$confirm('确认提交吗？', '提示', {}).then(() => {
                            req_update(_this.$refs[formName]._props.model).then((res) => {
                                if (res.data.code == 'S100101') {
                                    _this.$message.success('更新成功!');
                                    _this.onSearch();
                                } else {
                                    _this.$message.warning('更新失败! ' + res.data.msg);
                                    _this.onSearch();
                                }
                            }).catch((err) => {
                                _this.$message.error('更新失败!');
                            });
                            _this.updateFormVisible = false;
                        });
                    }
                });

            },
            resubmit(index, row, formName){
                let _this = this
                this.updateForm = Object.assign({}, row);
                this.updateForm.status = 2;
                req_update(this.updateForm).then((res) => {
                    if (res.data.code == 'S100101') {
                        _this.$message.success('重新提交成功!');
                        _this.onSearch();
                    } else {
                        _this.$message.warning('重新提交失败! ' + res.data.msg);
                        _this.onSearch();
                    }
                }).catch((err) => {
                    _this.$message.error('重新提交失败!');
                });
            },
            audit(row,yesOrNo){
                var _this = this
                console.log(row)
                let status ;
                if(yesOrNo=='yes'){
                    status=3;
                }else if(yesOrNo=='no'){
                    status=4
                }else{_this.$message.error("异常操作!!!");return false;}
                req_check({id:row.id,status:status}).then((res)=>{
                    if (res.data.code == 'S100101') {
                        _this.$message.success(res.data.msg);
                        _this.onSearch();
                    } else {
                        _this.$message.warning('操作失败! ' + res.data.msg);
                        _this.onSearch();
                    }
                }).catch((err)=>{
                    _this.$message.error('审核失败!');
                    console.log('审核失败：'+err);
                });
            },
            formatCommDatas(row, column){
                return utils.formatCommDatas(row, column);
            },
            formatDicTionary(value,type){
                return utils.formatDicTionary(value,type);
            },
        },
        computed: {},
        created() {

        },
        mounted(){
            this.seachUserByCurrent();
            this.onSearch();
            this.apiLocationList=utils.getDictDatasByType("api_location");// 网络类型所在区域 列表
        }


    };
</script>


